package com.suxin.ratelimit.repository.springdata;

import com.suxin.ratelimit.Rate;
import com.suxin.ratelimit.repository.AbstractRateLimiter;

import javax.annotation.Resource;

/**
 * @author Tang
 * @classname JpaRateLimiter
 * @description [  ]
 * @date 2021/7/14 22:48
 */
public class JpaRateLimiter extends AbstractRateLimiter {

    @Resource
    IRateLimiter iRateLimiter;

    @Override
    public Rate getRate(String key) {
        return iRateLimiter.findByKey(key);
    }

    @Override
    public void saveRate(Rate value) {
        iRateLimiter.saveRate(value);
    }
}